
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
import time

# 启动浏览器
driver = webdriver.Edge()
# 最大化窗口
driver.maximize_window()

try:
    driver.get("http://121.43.169.97:8848/pageA.html")
    driver.implicitly_wait(5)
    time.sleep(3)
    driver.find_element(By.CSS_SELECTOR, "#userA").send_keys("admin")
    time.sleep(3)
    search_box = driver.find_element(By.NAME, "userA")
    # 实例化对象：
    actions = ActionChains(driver)
    # 执行右键点击
    actions.double_click(search_box).perform()
    time.sleep(3)

except Exception as e:
    print(f"发生错误: {e}")

finally:
    driver.quit()
